<template>
  <div class="setting-container">
    
    <div class="setting-group" v-for="(group, index) in settingGroups" :key="index">
      <van-cell-group>
        <van-cell 
          v-for="item in group.items" 
          :key="item.name" 
          :title="item.title" 
          :icon="item.icon"
          is-link 
          @click="navigateTo(item.name)"
        />
      </van-cell-group>
    </div>
    
   
  </div>
</template>

<script>
	
export default {
  data() {
    return {
      // 设置项分组配置
      settingGroups: [
        {
          title: '账户设置',
          items: [
            { title: '收货地址', name: 'addressList' },
            { title: '账号安全', name: 'accountSec'},
            { title: '隐私设置', name: '' },
            { title: '支付设置', name: '' }
          ]
        },
        {
          title: '应用设置',
          items: [
            { title: '消息通知', name: '' },
            { title: '通用设置', name: '' },
            { title: '清理缓存', name: '' },
            { title: '长辈版', name: '' },
            { title: '未成年模式', name: '' }
          ]
        },
        {
          title: '关于应用',
          items: [
            { title: '关于我们', name: ''},
            { title: '意见反馈', name: 'feedback' },
            { title: '切换账号', name: '' }
          ]
        }
      ],
      isLoggedIn: true // 从store或cookie获取登录状态
    }
  },
  methods: {
    // 统一路由跳转方法
    navigateTo(routeName) {
      // 添加特殊路由处理逻辑
      if (routeName === 'clearCache') {
        this.clearCache();
        return;
      }
      
      this.$router.push({ name: routeName });
    },
    
    // 清理缓存方法
    clearCache() {
      this.$toast.loading({
        message: '清理中...',
        forbidClick: true
      });
      
      // 模拟清理缓存
      setTimeout(() => {
        this.$toast.success('缓存已清理');
      }, 1000);
    },
    
   
  }
}
</script>

<style scoped>
.setting-container {
  padding: 15px;
  background-color: #f8f8f8;
  min-height: 100vh;
}

.setting-group {
  margin-bottom: 15px;
}

.logout-container {
  padding: 15px;
  text-align: center;
}

/* 自定义图标样式 */
.van-cell__left-icon {
  color: #3273dc;
}
</style>
    